import React, { Component } from 'react';
import styles from './style.scss';
import PropTypes from 'prop-types';
import { Table } from 'antd';
import img from './image/icon-table-default.png'

class Tables extends Component {
    static propTypes = {
        locale: PropTypes.object,
        emptyText: PropTypes.string,
    };

    static defaultProps = {
        // locale: {
        //     filterConfirm: '确定' ,
        //     filterReset: '重置' ,
        //     emptyText: () => {
        //         return (
        //             <div className={styles.nodata} style={{width:'100%',height:220,verticalAlign:'center',textAlign:'center',backgroundImage:`url(${img})`}}>
        //                 暂无符合条件的信息
        //             </div>
        //         );
        //     } 
        // }
    };
    render() {
        let { emptyText, locale, ...others } = this.props;
        if (!locale) {
            locale = {
                filterConfirm: '确定',
                filterReset: '重置',
                emptyText: () => {
                    return (
                        <div className={styles.nodata} style={{ width: '100%', height: 220, verticalAlign: 'center', textAlign: 'center', backgroundImage: `url(${img})` }}>
                            {emptyText ? emptyText : "暂无符合条件的信息"}
                        </div>
                    );
                }
            }
        }
        return (
            <Table
                bordered
                locale={locale}
                {...others}
            />
        );
    }
}

export default Tables;